namespace CSharpPro._1023;
using System;


public enum Gender
{
    男,
    女
}
public class Student
{
    
    private string id;         
    private string name;       
    private Gender gender;     
    private string className;  

    
    public string Id
    {
        get => id;
        set
        {
            if (string.IsNullOrWhiteSpace(value))
                throw new ArgumentException("学号不能为空！");
            id = value;
        }
    }

    public string Name
    {
        get => name;
        set
        {
            if (string.IsNullOrWhiteSpace(value))
                throw new ArgumentException("姓名不能为空！");
            name = value;
        }
    }

    public Gender Gender
    {
        get => gender;
        set => gender = value;
    }

    public string ClassName
    {
        get
            => className;
        set
        {
            if (string.IsNullOrWhiteSpace(value))
                throw new ArgumentException("班级不能为空！");
            className = value;
        }
    }

  
    public Student() { }  // 无参构造函数

    public Student(string id, string name, Gender gender, string className)
    {
        
        Id = id;
        Name = name;
        Gender = gender;
        ClassName = className;
    }

  
    public override string ToString()
    {
        return $"学号：{Id}，姓名：{Name}，性别：{Gender}，班级：{ClassName}";
    }
}